package com.shen.cloud.controller;

import com.shen.cloud.pojo.Department;
import com.shen.cloud.service.DepartmentClientService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class DepartmentConsuController {

    @Resource
    DepartmentClientService departmentClientService;

    /**
     * 获得对应id的department
     * @param id
     * @return
     */
    @RequestMapping("/consumer/dept/get/{id}")
    public Department get(@PathVariable("id")Long id){
        return  departmentClientService.selectDepartmentById(id);
    }

    /**
     *增加department
     * @param department
     * @return
     */
    @RequestMapping("/consumer/dept/add")
    public boolean insertDepartment(Department department){
        return departmentClientService.insertDepartment(department);
    }

    /**
     * 获取所有department
     * @return
     */
    @RequestMapping("/consumer/departs/list")
    public List<Department> selectAllDepartment(){
        return departmentClientService.selectAllDepartment();
    }


}
